package com.whksoft.mymapplugin.utils;

import com.whksoft.mymapplugin.MyMapPlugin;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;

public class itemUtils {

    // TODO: 2021/1/29 清除所有扫码地图
    public static void clearMaps(Player p){
        Plugin plugin = MyMapPlugin.getInstance();
        NamespacedKey key = new NamespacedKey(plugin, "isQRCode");
        for(ItemStack itemStack : p.getInventory()){
            if(itemStack == null) continue;
            if(itemStack.getType() == Material.FILLED_MAP){
                if(flagUtils.haveQRFlag(key,itemStack)){
                    itemStack.setAmount(0);
                }
            }
        }
    }


}
